﻿<%@ Page Title="Raw Material Order" Language="C#" MasterPageFile="~/TableMaster.master" AutoEventWireup="true" CodeFile="RawMaterialOrder.aspx.cs" Inherits="Pages_RawMaterialOrder" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <style>
        @media only screen and (max-width: 760px), (min-device-width: 768px) and (max-device-width: 1024px) {

            .resTbl tr:nth-of-type(odd) {
                background-color: #CDE2FF;
            }

            .resTbl tr:nth-of-type(1) {
                display: none;
            }

            .resTbl td:nth-of-type(1):before {
                content: "Rm Order Number";
            }

            .resTbl td:nth-of-type(2):before {
                content: "Supplier Code";
            }

            .resTbl td:nth-of-type(3):before {
                content: "Certification File";
            }

            .resTbl td:nth-of-type(4):before {
                content: "Certification File Original Name";
            }

            .resTbl td:nth-of-type(5):before {
                content: "Currency Id";
            }

            .resTbl td:nth-of-type(6):before {
                content: "Certification Date";
            }

            .resTbl td:nth-of-type(7):before {
                content: "Etd";
            }

            .resTbl td:nth-of-type(8):before {
                content: "Eta";
            }

            .resTbl td:nth-of-type(9):before {
                content: "Ets";
            }

            .resTbl td:nth-of-type(10):before {
                content: "Shipping Vessel";
            }

            .resTbl td:nth-of-type(11):before {
                content: "Is Active";
            }

            .resTbl td:nth-of-type(12):before {
                content: "Created By";
            }

            .resTbl td:nth-of-type(13):before {
                content: "Created Date";
            }
        }
    </style>


    <script>
        function toggleUploader(fu, btn) {
            $('#' + fu).toggle();
            if ($('#' + fu).is(":visible"))
                $(btn).val('Cancel');
            else
                $(btn).val('Replace');
        }
    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Add" runat="Server">

    <asp:Panel ID="pnlAdd" runat="server">

        <%-- <asp:UpdatePanel runat="server" ID="upd">
            <ContentTemplate>--%>
        <asp:HiddenField ID="hdnPoid" runat="server" />
        <table cellpadding="0" cellspacing="0" style="width: 100%;">

            <tr>
                <td>
                    <asp:Label ID="lblSupllierName" AssociatedControlID="ddlSupplier_Name" runat="server" Text="Supplier Name"></asp:Label>
                </td>
                <td>
                    <asp:DropDownList AutoPostBack="true" ID="ddlSupplier_Name" runat="server" OnSelectedIndexChanged="ddlSupplier_Name_SelectedIndexChanged"></asp:DropDownList>
                </td>
            </tr>

            <tr>
                <td>
                    <asp:Label ID="lblSupllierCode" runat="server" AssociatedControlID="txtSupplierCode" Text="Supplier Code"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtSupplierCode" runat="server" ReadOnly="true"></asp:TextBox>
                </td>
            </tr>

            <tr>
                <td>
                    <asp:Label ID="lblAddress" AssociatedControlID="txtSupplierAddress" runat="server" Text="Supplier Address"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtSupplierAddress" TextMode="MultiLine" Width="250px" ReadOnly="true" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="lblcontact" AssociatedControlID="txtSupplierContact" runat="server" Text="Supplier Contact"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtSupplierContact" ReadOnly="true" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="lblEmail" AssociatedControlID="txtSupplierEmail" runat="server" Text="Supplier Email"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ReadOnly="true" ID="txtSupplierEmail" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="lblShipping_Type" AssociatedControlID="ddl_Shipping_Type" runat="server" Text="Shipping Type"></asp:Label>
                </td>
                <td>
                    <asp:DropDownList ID="ddl_Shipping_Type" runat="server"></asp:DropDownList>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblPrice" runat="server" AssociatedControlID="txtPrice" Text="Price:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtPrice" required="required" type="number" step="1" min="0" Validate ="Number" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblCurrenct" runat="server" AssociatedControlID="ddlCurrency" Text="Currency:"></asp:Label>
                </td>
                <td>
                    <asp:DropDownList ID="ddlCurrency" runat="server"></asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblQuantity" runat="server" AssociatedControlID="txtQuantity" Text="Quantity:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtQuantity" required="required" type="number" step="1" min="0" Validate ="Number" runat="server"></asp:TextBox>
                </td>
            </tr>


            <tr id="trUpload" runat="server">
                <td style="width: 170px">
                    <asp:Label ID="lblCertification" runat="server" AssociatedControlID="fuploadCertification" Text="Upload Certificate"></asp:Label>
                </td>
                <td>
                    <asp:FileUpload required="required" ID="fuploadCertification" runat="server" />
                </td>
            </tr>

            <tr id="trCertificate" runat="server" style="display:none" >
                <td style="width: 170px">
                    <asp:Label ID="lblCertificate" runat="server" Text="Certificate"></asp:Label>
                </td>
                <td>
                    <asp:Label ID="lblDownloadCertificate" runat="server"></asp:Label>
                    <input type="button" value="Replace" onclick="toggleUploader('MainContent_Add_trUpload', this);" />
                </td>
            </tr>

            <tr id="trUpload2" runat="server">
                <td style="width: 170px">
                    <asp:Label ID="lblAgreement" runat="server" AssociatedControlID="fuploadAgreement" Text="Upload Agreement"></asp:Label>
                </td>
                <td>
                    <asp:FileUpload required="required" ID="fuploadAgreement" runat="server" />
                </td>
            </tr>

            <tr id="trAgreement" runat="server" style="display:none">
                <td style="width: 170px">
                    <asp:Label ID="lblAgreement2" runat="server" Text="Agreement"></asp:Label>
                </td>
                <td>
                    <asp:Label ID="lblDownloadAgreement" runat="server"></asp:Label>
                    <input type="button" value="Replace" onclick="toggleUploader('MainContent_Add_trUpload2', this);" />
                </td>
            </tr>


            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblCERTIFICATION_DATE" runat="server" AssociatedControlID="txtCERTIFICATION_DATE" Text="Certification Date:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox type="date" required="required" ID="txtCERTIFICATION_DATE" runat="server"></asp:TextBox>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblRM_ORDER_NUMBER" runat="server" AssociatedControlID="txtRM_ORDER_NUMBER" Text="RM Order Number:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtRM_ORDER_NUMBER" required="required" ReadOnly="true" runat="server"></asp:TextBox>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblETS" runat="server" AssociatedControlID="txtETS" Text="ETS:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox type="date" required="required" ID="txtETS" runat="server"></asp:TextBox>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblETA" runat="server" AssociatedControlID="txtETA" Text="ETA:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox type="date" required="required" ID="txtETA" runat="server"></asp:TextBox>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblETD" runat="server" AssociatedControlID="txtETD" Text="ETD:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox type="date" required="required" ID="txtETD" runat="server"></asp:TextBox>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblShippingVessel" runat="server" AssociatedControlID="txtShippingDetails" Text="Shipping Vessel:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtShippingDetails" Width="250px" TextMode="MultiLine" runat="server"></asp:TextBox>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblPaymentTerms" runat="server" AssociatedControlID="ddlPAYMENT_TERM_ID" Text="Payment Terms:"></asp:Label>
                </td>
                <td>
                    <asp:DropDownList ID="ddlPAYMENT_TERM_ID" runat="server"></asp:DropDownList>
                    <%--<asp:TextBox ID="txtPaymentTerms" Width="250px" TextMode="MultiLine" runat="server"></asp:TextBox>--%>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblShippingTerms" runat="server" AssociatedControlID="ddlSHIPPING_TERMS_ID" Text="Shipping Terms:"></asp:Label>
                </td>
                <td>
                    <asp:DropDownList ID="ddlSHIPPING_TERMS_ID" runat="server"></asp:DropDownList>
                    <%--<asp:TextBox ID="txtShippingTerms" Width="250px" TextMode="MultiLine" runat="server"></asp:TextBox>--%>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">&nbsp;</td>
                <td>

                    <asp:Button ID="btnSave" runat="server" CssClass="btn btn-success" OnClick="btnSave_Click" Text="Save" Width="90px" />
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <asp:Button ID="btnCancel" runat="server" CssClass="btn btn-danger" OnClick="btnCancel_Click" Text="Cancel" Width="90px" />

                </td>
            </tr>

        </table>
        <%-- </ContentTemplate>
        </asp:UpdatePanel>--%>
    </asp:Panel>

</asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderID="Grid" runat="Server">

    <asp:Panel ID="pnlList" runat="server">
        <asp:GridView ID="gridClients" runat="server" AutoGenerateColumns="False" CssClass="resTbl" DataSourceID="DS_tbl_raw_material_order">
            <Columns>
                <asp:BoundField DataField="RAW_ORDER_ID" HeaderText="RAW_ORDER_ID" SortExpression="RAW_ORDER_ID" />
                <asp:BoundField DataField="RMOrderNumber" HeaderText="RMOrderNumber" SortExpression="RMOrderNumber" />
                <asp:BoundField DataField="SupplierName" HeaderText="SupplierName" SortExpression="SupplierName" />
                <asp:BoundField DataField="Certificate" HeaderText="Certificate" SortExpression="Certificate" />
                <asp:BoundField DataField="CertificateDate" HeaderText="CertificateDate" SortExpression="CertificateDate" DataFormatString="{0:yyMMdd}" />
                <asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price" />
                <asp:BoundField DataField="Quantity" HeaderText="Quantity" SortExpression="Quantity" />
                <asp:BoundField DataField="Currency" HeaderText="Currency" SortExpression="Currency" />
                <asp:BoundField DataField="ETD" HeaderText="ETD" SortExpression="ETD" DataFormatString="{0:yyMMdd}" />
                <asp:BoundField DataField="ETA" HeaderText="ETA" SortExpression="ETA" DataFormatString="{0:yyMMdd}" />
                <asp:BoundField DataField="ETS" HeaderText="ETS" SortExpression="ETS" DataFormatString="{0:yyMMdd}" />
                <asp:BoundField DataField="ShippingType" HeaderText="ShippingType" SortExpression="ShippingType" />
                <asp:BoundField DataField="ShippingVessels" HeaderText="ShippingVessels" SortExpression="ShippingVessels" />
                <asp:BoundField DataField="Active" HeaderText="Active" SortExpression="Active" />
                <asp:BoundField DataField="CREATED_BY" HeaderText="CREATED_BY" SortExpression="CREATED_BY" />
                <asp:BoundField DataField="CREATED_DATE" HeaderText="CREATED_DATE" SortExpression="CREATED_DATE" DataFormatString="{0:yyMMdd}" />
                <asp:TemplateField HeaderText="Edit">
                    <ItemTemplate>
                        <asp:LinkButton ID="linkEdit" runat="server" Text="Edit" CommandArgument='<%# Eval("RAW_ORDER_ID") %>' OnClick="linkEdit_Click"></asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Delete">
                    <ItemTemplate>
                        <asp:LinkButton ID="linkDelete" CommandName="delete" runat="server" Text="Delete" OnClientClick="javascript:return confirm('Are you sure you want to delete this record?');" CommandArgument='<%# Eval("RAW_ORDER_ID") %>' OnClick="linkDelete_Click"></asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>

            </Columns>
        </asp:GridView>
        <asp:ObjectDataSource ID="DS_tbl_raw_material_order" runat="server" SelectMethod="selectAllForGrid" DeleteMethod="delete" TypeName="DAL_tbl_raw_material_order">
            <DeleteParameters>
                <asp:Parameter Name="RAW_ORDER_ID" Type="Int32" />
            </DeleteParameters>
        </asp:ObjectDataSource>
    </asp:Panel>

</asp:Content>

